﻿using System;
using System.Collections.Generic;
using System.Text;
using ET;

namespace Marx
{
    public class C2GTestHandler : AMRpcHandler<C2GTestReqeust, C2GTestResponse>
    {
        protected override async ETTask Run(Session session, C2GTestReqeust request, C2GTestResponse response, Action reply)
        {
            Log.Info(request.Content);
            response.Content = "Hello back";
            reply();
            await ETTask.CompletedTask;
        }
    }

    public class LoginRealmHandler : AMRpcHandler<LoginRealmRequest, LoginRealmResponse>
    {
        protected override async ETTask Run(Session session, LoginRealmRequest request, LoginRealmResponse response, Action reply)
        {
            response.Address = "127.0.0.1:20002";
            response.Players = new List<long>() { 10001 };
            response.Token = 1000;
            reply();
            await ETTask.CompletedTask;
        }
    }

    public class LoginGateHandler : AMRpcHandler<LoginGateRequest, LoginGateResponse>
    {
        protected override async ETTask Run(Session session, LoginGateRequest request, LoginGateResponse response, Action reply)
        {
            session.OnGateLoginFinish();
            reply();
            await ETTask.CompletedTask;
        }
    }
}
